<template>
    <ul>
        <li @click ="showName(item.name)" v-for="(item,index) in list":key="item.id">{{ index+1}}.{{ item.name }}</li>
    </ul>

    <button v-on:click="handle">确认</button>
</template>

<script setup>
const list = [
    {id:1, name:'DRAG ME DOWN'},
    {id:2, name:'LIVE WHILE WE YOUNG'},
    {id:3, name:'WHAT MAKES YOU BEAUTIFUL'},
    {id:4, name:'BEST SONG EVER'}
]

const handle = () => {
    console.log('handle');
}

const showName = () => {
    console.log(name);
}
</script>

<style lang="css" scoped>

</style>